﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

using CE.User;
using CE.Global;
using CE.Provider;

public partial class admin_user_Access_ViewProviderUserType : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session[CE.Global.General.UserId] == null)
        {
            Response.Redirect("~/Admin/AdminSecureLogin.aspx");
        }

        if (!IsPostBack)
        {
            DataTable _dtCompany = General.GetComboItem("TH.ProviderCompany", false);
            ddlProviderCompany.DataSource = _dtCompany;
            ddlProviderCompany.DataTextField = _dtCompany.Columns[0].ColumnName.ToString();
            ddlProviderCompany.DataValueField = _dtCompany.Columns[1].ColumnName.ToString();
            ddlProviderCompany.DataBind();

            ddlProviderCompany.Items.Insert(0, new ListItem("Select", "-1"));

            
        }

    }

    protected void ddlProviderCompany_SelectedIndexChanged(object sender, EventArgs e)
    {
        grvProviderUserType.DataBind();
    }

    protected void grvProviderUserType_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (grvProviderUserType.Rows.Count > 0)
        {
            string strCUID = grvProviderUserType.SelectedDataKey.Values[0].ToString();
            Response.Redirect("ProviderUserType.aspx?CUID=" + strCUID + "&PCID=" + ddlProviderCompany.Text);
        }
    }

    protected void btnAddNew_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/Admin/User/Access/ProviderUserType.aspx");
    }

}
